<template>
	<view class="content">
		<view class="hei20"></view>
		<view class="wid90 mar bacFFF borRad20" style="box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0,0,0,0.1);padding: 30rpx 0;">
			<view class="wid80 mar">
				<view class="foSi40 fowe600" style="">门店</view>
				<input class="textCen foSi25 borRad40 wid100 hei60" style="background-color: #E5E5E5;margin-top: 46rpx;"
					v-model="phone" type="text" placeholder="请输入输入手机号" />
				<input class="textCen foSi25 borRad40 wid100 hei60" style="background-color: #E5E5E5;margin-top: 34rpx;" 
					v-model="password" password type="text" placeholder="请输入密码" />
			</view>
			<view class="wid100 dis disAl disJuC" style="margin-top: 50rpx;">
				<view class="dis disAl disJuC borRad10 foSi30 coFFF" @click="denglu"
					style="width: 300rpx;height: 70rpx;background: #035DFF;">登录</view>
			</view>
			<view class="hei20"></view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				phone: '',
				password: '',
			}
		},
		onLoad() {
		},
		methods: {
			denglu() {
				var that = this;
				if(!that.phone){
					return uni.showToast({title: '请输入输入手机号',icon: 'error',duration: 2000})
				}
				if(!that.password){
					return uni.showToast({title: '请输入密码',icon: 'error',duration: 2000})
				}
				uni.request({
					url: that.global.url + '/api/qianyu_petrol/gasstation_clerk_login',
					method: "POST",
					header: {
						'site-id': that.global.site_id,//自定义请求头信息
						'token': uni.getStorageSync('token')
					},
					data: {
						mobile: that.phone,
						password: that.password
					},
					success(res) {
						let result = res.data
						console.log(result)
						if (result.code == 1) {
							uni.setStorageSync('yuan_userinfo', result.data);
							that.tiaozhuan('/pages/shop/workbench')
						}else{
							uni.showToast({
								title: result.msg,
								icon: 'none',
								duration: 1000
							});
						}
					}
				})
			},
			tiaozhuan(url){
				uni.redirectTo({
					url: url
				})
			}
		}
	}
</script>

<style>
	.content {
		background: #F6F9FE;
		height: 100vh;
	}

</style>
